//
//  drawerView.m
//  Sunexpress
//
//  Created by 无名 on 2017/5/8.
//  Copyright © 2017年 曹亮. All rights reserved.
//

#import "drawerView.h"
#import <Masonry.h>
@implementation drawerView
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.Headportrait = [[UIButton alloc]init];
        self.Headportrait.layer.cornerRadius = 40;
        self.Headportrait.backgroundColor = [UIColor redColor];
        [self addSubview:self.Headportrait];
        
        
        self.nameLabel = [[UILabel alloc]init];
        [self addSubview:self.nameLabel];
        
        
        self.orderBut = [[UIButton alloc]init];
        [self.orderBut setTintColor:[UIColor blackColor]];
        [self.orderBut setTitle:@"订单" forState:0];
        [self.orderBut setTitleColor:[UIColor blackColor] forState:0];
        self.orderBut.titleEdgeInsets = UIEdgeInsetsZero;
        self.orderBut.imageEdgeInsets = UIEdgeInsetsZero;
        [self.orderBut setImage:[UIImage imageNamed:@"dddd"] forState:0];
        [self addSubview:self.orderBut];
        
        
        
        self.balanceBut = [[UIButton alloc]init];
        [self.balanceBut setTitle:@"余额" forState:0];
        [self.balanceBut setTitleColor:[UIColor blackColor] forState:0];
        [self.balanceBut setImage:[UIImage imageNamed:@"aaaa"] forState:0];
        self.balanceBut.titleEdgeInsets = UIEdgeInsetsZero;
        self.balanceBut.imageEdgeInsets = UIEdgeInsetsZero;
        
        [self addSubview:self.balanceBut];
        
        
        
        self.addressBut = [[UIButton alloc]init];
//        self.addressBut.backgroundColor = [UIColor greenColor];
        [self.addressBut setImage:[UIImage imageNamed:@"bbb"] forState:0];
        [self.addressBut setTitle:@"地址" forState:0];
        [self.addressBut setTitleColor:[UIColor blackColor] forState:0];
        self.addressBut.titleEdgeInsets = UIEdgeInsetsZero;
        self.addressBut.imageEdgeInsets = UIEdgeInsetsZero;
        [self addSubview:self.addressBut];
        
        
        
        [self.Headportrait mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(64);
            make.left.equalTo(self.mas_left).offset(80);
            make.width.mas_equalTo(80);
            make.height.mas_equalTo(self.Headportrait.mas_width);
        }];
        [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.Headportrait.mas_bottom);
            make.left.equalTo(self.mas_left).offset(50);
            make.right.equalTo(self.mas_right).offset(-50);
        }];
        [self.orderBut mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.nameLabel.mas_bottom).offset(100);
            make.left.equalTo(self.mas_left).offset(50);
            make.right.equalTo(self.mas_right).offset(-50);
            make.height.mas_equalTo(60);
        }];
        [self.balanceBut mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.orderBut.mas_bottom).offset(50);
            make.left.equalTo(self.mas_left).offset(50);
            make.right.equalTo(self.mas_right).offset(-50);
            make.height.mas_equalTo(60);
        }];
        [self.addressBut mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.balanceBut.mas_bottom).offset(50);
            make.left.equalTo(self.mas_left).offset(50);
            make.right.equalTo(self.mas_right).offset(-50);
            make.height.mas_equalTo(60);
        }];
    }
    return self;
}
@end
